#include<bits/stdc++.h>
using namespace std;
int n,a[100010],b[100010],c[100010];
int main(){
freopen("duel.in","r",stdin);
freopen("duel.out","w",stdout);
cin>>n;
for(int i=1;i<=n;i++){
    cin>>a[i];
}
sort(a+1,a+1+n);
b[1]=1;
int t=2;
for(int i=2;i<=n;i++){
    if(a[i]!=a[i-1]){
        b[t]=i;
        t++;
    }
}
t--;
for(int i=2;i<=t;i++){

}
for(int i=1;i<t;i++){
    c[i]=b[i+1]-b[i];
}
c[t]=n-b[t]+1;
for(int i=2;i<=t;i++){
    if(c[i]==0){
        break;
    }
    if(c[i]>=(b[i]-b[i-1])){
        c[i]-=b[i]-b[i-1];
    }
    if(c[i]<(b[i]-b[i-1])){
        c[i]=0;
    }
}
int s=0;
for(int i=1;i<=t;i++){
    s+=c[i];
}
cout<<s;
return 0;
}
